package com.theydream.qeechain.map;

import android.location.Location;

import com.google.android.maps.OverlayItem;
import com.theydream.qeechain.globaldata.GlobalData;
import com.theydream.qeechain.map.interfaces.ILocationLogic;

public class LocationLogic implements ILocationLogic{
	private static LocationLogic instance=new LocationLogic();
	
	public LocationLogic getInstance()
	{
		return instance;
	}
	
	LocationLogic()
	{
		
	}
	
	public boolean canFlyTo(OverlayItem item)
	{
		double radius=1000.0;
		GlobalData gbData=GlobalData.getInstance();
		Location markerLocation=new Location("Maker");
		markerLocation.setLatitude(item.getPoint().getLatitudeE6()/1E6);
		markerLocation.setLongitude(item.getPoint().getLongitudeE6()/1E6);
		
		if (markerLocation.distanceTo(gbData.getUserLocation()) <radius)
		{
			return true;
		}
		else
		{
			return false;
		}
		
	}

}
